package com.syxx.oa.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.syxx.oa.domain.ApproveInfo_1;
import com.test.jbpm.dao.impl.BaseDao;

@Repository
public class ApproveDao1 extends BaseDao {
	public Long add(ApproveInfo_1 approveInfo) {
		Long _id = (Long) getHibernateTemplate().save(approveInfo);
		return _id;
	}

	@SuppressWarnings("unchecked")
	public List<ApproveInfo_1> findHistoryByTroubleTicketId(
			Long troubleTicketId) {
		return getHibernateTemplate().find("from ApproveInfo_1 ai where ai.perReq._id=? order by ai.approveTime", troubleTicketId);
	}
	
	public ApproveInfo_1 findById(Long id){
		if(id == null || id==0L){
			return null;
		}
		return (ApproveInfo_1) getHibernateTemplate().load(ApproveInfo_1.class, id);
	}

}
